//
//  PhotoAlertViewController.m
//  AncientVillage
//
//  Created by 陈志亮 on 2018/9/17.
//  Copyright © 2018年 LSJ. All rights reserved.
//

#import "PhotoAlertViewController.h"
#import "JKCategories.h"

@implementation PhotoAlertViewController

+(UIAlertController*)getPhotoAlbumAlertLeftBlock:(void(^)(UIAlertAction * action))photoBlock   rightBlock:(void(^)(UIAlertAction *  action))albumBlock{
    
    UIAlertController * alerController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    
    UIAlertAction * photoAction = [UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
       
              !photoBlock?:photoBlock(action);
       
      
    }];
    
    UIAlertAction * albumAction = [UIAlertAction actionWithTitle:@"从相册选择" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
      !albumBlock?:albumBlock(action);

    }];
    [albumAction setValue: [UIColor jk_colorWithWholeRed:22 green:120 blue:238 alpha:1.0] forKey:@"titleTextColor"];
   
    UIAlertAction * cancleAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    [alerController addAction:photoAction];
    [alerController addAction:albumAction];
    [alerController addAction:cancleAction];
    
    return alerController;
}

+(UIAlertController*)getAlertViewWithTitle:(NSString*)title cancleTitle:(NSString*)canlceStr cancleBlock:(void(^)(UIAlertAction *  action))cancleBlock{
    
    UIAlertController * alerController = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleAlert];
    
    UIAlertAction * cancleAction = [UIAlertAction actionWithTitle:canlceStr style:UIAlertActionStyleCancel handler:^(UIAlertAction *  action) {
        !cancleBlock?:cancleBlock(action);
    }];
    
    [alerController addAction:cancleAction];
    
    return alerController;
}




@end
